package utilidade;

import java.io.Serializable;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class Produtor  implements Serializable{
		
	private static final long serialVersionUID = 1L;
	

	@Produces @ApplicationScoped 
	public EntityManagerFactory criarFactoryBDA(){
		
		return Persistence.createEntityManagerFactory("BANCO");
		
	}
	
	@Produces @RequestScoped 
	public EntityManager criarEntityBDA(EntityManagerFactory factory){
		
		return factory.createEntityManager();
		
	}
	

}
